<?

if ($DATA['component']['id']) {

	$_defaults = array('id_data' => D_MB_DATA, 'id_parent' => $DATA['component']['id'], 'name' => 'text');
																										  

	switch (action(array('editor_save'))) {
	
		case 'editor_save':

			$b = postdata('body');
			$temp = array();

			foreach($DATA['langs'] as $lang)
				$temp[] = array_merge($_defaults, array('value' => $b[$lang['text']], 'assoc' => $lang['text']));
			
			dataset('db_delete', tb('data'), "(id_data=".D_MB_DATA.") AND (id_parent={$DATA[component][id]}) AND (name='text')");
			dataset('db_insert', tb('data'), $temp);
			
			return true;	// end of component edition
	}
	
		
	$DATA['object'] = datafetch_array('db_list', array(
		'table' => tb('data'), 
		'where' => "(id_data=".D_MB_DATA.") AND (id_parent={$DATA[component][id]}) AND (name='text')", 
		'index' => 'assoc' ));
	
	return false;

} else exit;

?>